import request from '@/utils/utils'

/**
 * 添加订单
 * @param {*} params
 * @returns
 */
export function addOrder (params) {
  return request.post('/order/addOrder', params)
}

/**
 * 获取确认订单信息
 * @param {*} params
 * @returns
 */
export function confirmOrder (params) {
  return request.get('/order/confirmOrder', { params })
}

/**
 * 获取地址列表
 * @param {*} params
 * @returns
 */
export function getAddressList (params) {
  return request.get('/address/list', { params })
}

/**
 * 添加地址
 * @param {*} params
 * @returns
 */
export function newAddress (params) {
  return request.post('/address/add', params)
}

/**
 * 获取默认地址
 * @param {*} params
 * @returns
 */
export function getDefaultAddress (params) {
  return request.post('/address/defaultAddress', params)
}

/**
 * 地址列表修改订单地址
 * @param {*} params
 * @returns
 */
export function updateOrderAddress (params) {
  return request.post('/order/updateOrderAddress', params)
}

/**
 * 删除地址
 * @param {*} params
 * @returns
 */
export function deleteAddress (params) {
  return request.post('/address/delete', params)
}

/**
 * 支付时删除购物车选中的数据
 * @param {*} params
 * @returns
 */
export function deleteCartItem (params) {
  return request.get('/order/deleteCartItem', params)
}
